package com.nbsaas.boot.product.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "商品图片", model = "商品图片")
@Entity
@Table(name = "bs_product_image")
@Comment("商品图片表")
public class ProductImage extends AbstractEntity {

    @Comment("商品ID")
    @FormField(title = "商品ID", sortNum = "1", grid = true, required = true)
    private Long productId;

    @Comment("SKU ID")
    @FormField(title = "SKU ID", sortNum = "2", grid = true)
    private Long skuId;

    @Comment("图片URL")
    @FormField(title = "图片URL", sortNum = "3", grid = true, required = true)
    @Column(length = 500, nullable = false)
    private String imageUrl;

    @Comment("图片类型")
    @FormField(title = "图片类型", sortNum = "4", grid = true, type = InputType.select)
    @Column(length = 20)
    private String imageType; // MAIN-主图, DETAIL-详情图, SKU-SKU图

    @Comment("图片标题")
    @FormField(title = "图片标题", sortNum = "5", grid = true)
    @Column(length = 200)
    private String title;

    @Comment("图片描述")
    @FormField(title = "图片描述", sortNum = "6", grid = true)
    @Column(length = 500)
    private String description;

    @Comment("图片排序")
    @FormField(title = "图片排序", sortNum = "7", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("是否启用")
    @FormField(title = "是否启用", sortNum = "8", grid = true, type = InputType.select)
    private Boolean enabled;

    @Comment("图片宽度")
    @FormField(title = "图片宽度", sortNum = "9", grid = true, type = InputType.el_input_number)
    private Integer width;

    @Comment("图片高度")
    @FormField(title = "图片高度", sortNum = "10", grid = true, type = InputType.el_input_number)
    private Integer height;

    @Comment("文件大小(字节)")
    @FormField(title = "文件大小(字节)", sortNum = "11", grid = true, type = InputType.el_input_number)
    private Long fileSize;

    @Comment("文件格式")
    @FormField(title = "文件格式", sortNum = "12", grid = true)
    @Column(length = 20)
    private String fileFormat;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "13", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String note;
} 